package com.visionforge.sdk;

import java.util.List;

/**
 * 检测结果类，对应API返回的JSON数据结构
 */
public class DetectionResult {
    private String original_url;
    private String detected_url;
    private List<Detection> detections;
    private ImageSize image_size;
    private ModelUsed model_used;
    private String message;

    // Getters and Setters
    public String getOriginal_url() {
        return original_url;
    }

    public void setOriginal_url(String original_url) {
        this.original_url = original_url;
    }

    public String getDetected_url() {
        return detected_url;
    }

    public void setDetected_url(String detected_url) {
        this.detected_url = detected_url;
    }

    public List<Detection> getDetections() {
        return detections;
    }

    public void setDetections(List<Detection> detections) {
        this.detections = detections;
    }

    public ImageSize getImage_size() {
        return image_size;
    }

    public void setImage_size(ImageSize image_size) {
        this.image_size = image_size;
    }

    public ModelUsed getModel_used() {
        return model_used;
    }

    public void setModel_used(ModelUsed model_used) {
        this.model_used = model_used;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    /**
     * 检测到的目标类
     */
    public static class Detection {
        private String clazz; // 避免使用关键字class
        private int class_id;
        private double confidence;
        private BoundingBox bbox;

        // Getters and Setters
        public String getClazz() {
            return clazz;
        }

        public void setClazz(String clazz) {
            this.clazz = clazz;
        }

        public int getClass_id() {
            return class_id;
        }

        public void setClass_id(int class_id) {
            this.class_id = class_id;
        }

        public double getConfidence() {
            return confidence;
        }

        public void setConfidence(double confidence) {
            this.confidence = confidence;
        }

        public BoundingBox getBbox() {
            return bbox;
        }

        public void setBbox(BoundingBox bbox) {
            this.bbox = bbox;
        }
    }

    /**
     * 边界框类
     */
    public static class BoundingBox {
        private double xmin;
        private double ymin;
        private double xmax;
        private double ymax;

        // Getters and Setters
        public double getXmin() {
            return xmin;
        }

        public void setXmin(double xmin) {
            this.xmin = xmin;
        }

        public double getYmin() {
            return ymin;
        }

        public void setYmin(double ymin) {
            this.ymin = ymin;
        }

        public double getXmax() {
            return xmax;
        }

        public void setXmax(double xmax) {
            this.xmax = xmax;
        }

        public double getYmax() {
            return ymax;
        }

        public void setYmax(double ymax) {
            this.ymax = ymax;
        }
    }

    /**
     * 图片尺寸类
     */
    public static class ImageSize {
        private int width;
        private int height;

        // Getters and Setters
        public int getWidth() {
            return width;
        }

        public void setWidth(int width) {
            this.width = width;
        }

        public int getHeight() {
            return height;
        }

        public void setHeight(int height) {
            this.height = height;
        }
    }

    /**
     * 使用的模型信息类
     */
    public static class ModelUsed {
        private String code;
        private String name;
        private boolean is_fallback;

        // Getters and Setters
        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public boolean isIs_fallback() {
            return is_fallback;
        }

        public void setIs_fallback(boolean is_fallback) {
            this.is_fallback = is_fallback;
        }
    }
}